<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑广告</title>
<load href="__PUBLIC__/css/bootstrap.min.css" />
<import type='css' file="css.daterangepicker-bs3" />
<import type='css' file="css.main" />
<load href="__PUBLIC__/js/jquery-1.9.1.min.js" />
<load href="__PUBLIC__/js/jquery-ui.min.js" />
<import type='js' file="js.main" />
<import type='js' file="js.setshowflag" />
<import type='js' file="js.moment" />
<import type='js' file="js.daterangepicker" />
<script type="text/javascript">
$(function(){
	$('#ad_pushstarttime').daterangepicker({ singleDatePicker: true }, function(start, end, label) {
		console.log(start.toISOString(), end.toISOString(), label);
	});
	$('#ad_pushendtime').daterangepicker({ singleDatePicker: true }, function(start, end, label) {
		console.log(start.toISOString(), end.toISOString(), label);
	});
	
	$("input[name='ad_push']").click(function(){
		if($(this).attr("v")==0){
			$(this).attr("v",1);
			$(this).attr("checked","checked");
			$(".obj-form li.malist").show();
			ulheight();
		}else{
			$(this).attr("v",0);
			$(this).removeAttr("checked");
			$(".obj-form li.malist").hide();	
		}
	})
	$(".obj-form li.malist ul li:nth-child(4n)").css({"margin-right":"0px"});

	function ulheight(){
		var ul = $(".obj-form li.malist ul");
		var ulheight = ul.height();
		if(ulheight>250){
			ul.height(250);
		}
	}
	
	$("input[name='select_all']").click(function(){
		if($(this).attr("v")==0){
			$(this).attr("v",1);
			$(".obj-form li.malist li").each(function(index, element) {
                $(this).find("input").prop("checked","checked");
            });
		}else{
			$(this).attr("v",0);
			$(this).removeAttr("checked");
			$(".obj-form li.malist li").each(function(index, element) {
                $(this).find("input").removeAttr("checked");
            });	
		}	
	})
})
</script>
<style type="text/css">
.obj-form li.malist{margin-top:-10px;}
.obj-form li.malist ul{display:block; clear:both; border:solid 1px #eee; border-radius:5px; width:670px; list-style:none; padding:0px; margin:0px; padding:6px; overflow:scroll; overflow-x:hidden;}
.obj-form li.malist ul li{clear:none; float:none; padding:0px; margin:0px; display:block; float:left; width:150px; overflow:hidden; height:24px; line-height:24px; margin-right:12px;}
div.pushhead{border-bottom:solid 1px #eee; clear:both; margin-bottom:10px;}
</style>
</head>

<body id="body">
<div class="main-frame">
	<div class="position">华人码 > 添加广告</div>
	<!-- 图片资源开始 -->
	<div class="floatBackground" id="floatBackground" style="display: none;">
		<div class="bounced">
		<label class="closeImgResurces">X</label>
		<iframe id="imgResourcesiframe" src="{:rtrim(U('Upload/index'),'.html')}" width="750" height="465" frameborder="0" scrolling="auto"></iframe>
		</div>
	</div>
	<!-- 图片资源结束 -->
	<div class="addobject">
		<div class="obj-form">
			<form name="form1" id="form1" action="{:U('Ad/edit',array('id'=>$adresult['id']))}" method="post" class="form-inline">
				<ul>
					<li>
						<label class="fl tle">广告名称：</label>
						<span class="fl cnt"><input name="ad_name" class="form-control" placeholder="广告名称" value="{$adresult['ad_name']}" style="width: 450px;"><em>*</em></span>
					</li>
					<li>
						<label class="fl tle">广告图：</label>
						<span class="fl cnt"><input name="ad_img" id="thumbimg" class="form-control" placeholder="广告图" value="{$adresult['ad_img']}" style="width: 450px;"><a class="browse" f='thumbimg'>浏览···</a></span>
					</li>
					<li>
						<label class="fl tle"></label>
						<span class="fl cnt"><img src="{$adresult['ad_img']}" height="50" /></span>
					</li>
					<li>
						<label class="fl tle">链接：</label>
						<span class="fl cnt"><input name="ad_link" class="form-control" placeholder="链接" value="{$adresult['ad_link']}" style="width: 450px;"><em>*</em></span>
					</li>
					<li>
						<label class="fl tle">开始日期：</label>
						<span class="fl cnt"><input name="ad_pushstarttime" id="ad_pushstarttime" readonly="readonly" class="txtlength200" style="width: 160px;" placeholder="开始日期" value="{$adresult['ad_pushstarttime']}"><em>*</em></span>
					</li>
					<li>
						<label class="fl tle">结束日期：</label>
						<span class="fl cnt"><input name="ad_pushendtime" id="ad_pushendtime" readonly="readonly" class="txtlength200" style="width: 160px;" placeholder="结束日期" value="{$adresult['ad_pushendtime']}"><em>*</em></span>
					</li>
					<li>
						<label class="fl tle">显示位置：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="ad_type" value="1"<if condition="$adresult['ad_type'] eq 1"> checked="checked"</if>> 置底&nbsp;&nbsp;
							<input class="radio" type="radio" name="ad_type" value="2"<if condition="$adresult['ad_type'] eq 2"> checked="checked"</if>> 居中弹出
						</span>
					</li>
					<li>
						<label class="fl tle">是否关闭：</label>
						<span class="fl cnt">
							<input type="checkbox" value="0" name="ad_isclose"<if condition="$adresult['ad_isclose'] eq 1"> checked="checked"</if> class="extendedattr" style="margin-top:9px">
						</span>
					</li>
					<li>
						<label class="fl tle">添加时间：</label>
						<span class="fl cnt"><input name="ad_addtime" class="txtlength200" readonly="readonly" style="width: 160px;" placeholder="发布时间" value="{$adresult['ad_addtime']}"></span>
					</li>
					<li>
						<label class="fl tle">推送：</label>
						<span class="fl cnt">
							<input type="checkbox" value="1" name="ad_push" class="extendedattr"<if condition="$adresult['ad_push'] eq 1"> checked="checked" v="1"<else /> v="0"</if>> 是否推送
						</span>
					</li>
					<li class="malist" style="display:<if condition="$adresult['ad_push'] eq 1">block<else />none</if>;">
						<label class="fl tle"></label>
						<span class="fl cnt">
                        	<ul>
                        	<div class="pushhead"><input type="checkbox" value="1" name="select_all" class="extendedattr" v="0">全选</div>
                        		<volist name='typelist' id='v'>
                                <li><input type="checkbox" value="{$v.id}" name="ad_push_ma[]" class="extendedattr"<if condition="stripos($v['adid'],$adresult['id']) nheq false"> checked="checked"</if>>{$v.typename}</li>
                                </volist>
                            </ul>
						</span>
					</li>
					<li class="submit">
						<label class="fl tle">&nbsp;</label>
						<span class="fl cnt"><input type="submit" value="确 定" class="submitbtn" /></span>
					</li>
				</ul>
			</form>
		</div>
		<div class="obj-previewimg">
			<div class="instructions">
				<b>备注说明：</b><br>
				1、带有红色  “ * ” 项必填<br>
			</div>
		</div>
	</div>

</div>
</body>
</html>
